'use strict';

module.exports = class extends think.Logic {
    paymentAction() {
        const rules = {
            ono: { string: true, required: false, method: 'GET' }, // 订单编号
            order: { int: true, required: false, default: 0, method: 'GET' }, // 订单ID
            setp: { string: true, required: false, default: '', method: 'GET' }, // 订单步骤
            type: { int: true, required: true, default: 0, method: 'GET' }, // 支付类型 0:购物 1:充值
        };

        const msgs = {
            order: {
                required: '缺少参数订单号',
            },
        };

        const flag = this.validate(rules, msgs);
        if (!flag) {
            return this.fail('validate error', msgs);
            // 如果校验失败，返回
            // {"errno":1000,"errmsg":"validate error","data":{"username":"username can not be blank"}}
        }
    }

    payAction() {
        const rules = {
            order: { int: true, required: true, default: 0, method: 'GET' }, // 订单ID
            payment: { int: true, required: true, method: 'GET' }, // 支付方式
        };

        const msgs = {
            order: {
                required: '缺少参数订单号',
            },
        };

        const flag = this.validate(rules, msgs);
        if (!flag) {
            return this.fail('validate error', msgs);
            // 如果校验失败，返回
            // {"errno":1000,"errmsg":"validate error","data":{"username":"username can not be blank"}}
        }
    }
};
